import axios from '@/lib/axios'
const $API = 'https://openapi.dataoke.com/api'
import DtkSign from '@/utils/dtksign'

// 获取搜索热词
const getHotKeywords = data => axios.get(
  `${$API}/category/get-top100`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 联想词
const getSuggestions = data => axios.get(
  `${$API}/goods/search-suggestion`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 获取商品列表
const getItemList = data => axios.get(
  `${$API}/goods/get-goods-list`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 获取商品详情
const getItemDetail = data => axios.get(
  `${$API}/goods/get-goods-details`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 联盟搜索
const searchItem = data => axios.get(
  `${$API}/tb-service/get-tb-service`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 猜你喜欢
const guessWouldLike = data => axios.get(
  `${$API}/goods/list-similer-goods-by-open`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 超级分类
const getCategoryList = data => axios.get(
  `${$API}/category/get-super-category`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 各大榜单
const getRankingList = data => axios.get(
  `${$API}/goods/get-ranking-list`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 9.9包邮
const nineIncloudPostage = data => axios.get(
  `${$API}/goods/nine/op-goods-list`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 精选专辑分类
const topicCatalogue = data => axios.get(
  `${$API}/goods/topic/catalogue`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 精选专辑商品列表
const topicList = data => axios.get(
  `${$API}/goods/topic/goods-list`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

// 大淘客首页轮播列表
const dtkCarousel = data => axios.get(
  `http://cmsjapi.ffquan.cn/api/category/product/model-detail-by-model-id-new`, {
    entityId: 4,
    modelId: -1,
    proModelId: 1,
    source: 3,
    version: 'v1',
    tuserId: 762101,
    isWechat: 0,
  }
)

// test，测试接口！！！！！！
const test = data => axios.get(
  `${$API}/goods/topic/catalogue`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)
// test1，测试接口！！！！！！
const test1 = data => axios.get(
  `${$API}/goods/topic/goods-list`, { ...data,
    ...DtkSign.requestDtk(data)
  }
)

export default {
  getHotKeywords,
  getSuggestions,
  getItemList,
  getItemDetail,
  searchItem,
  guessWouldLike,
  getCategoryList,
  getRankingList,
  nineIncloudPostage,
  topicCatalogue,
  topicList,
  dtkCarousel,
  test,
  test1,
}
